package com.uzai.console.web.fd;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.fd.fdfollowgroupconfig.FdFollowGroupConfigDto;
import com.uzai.console.dto.fd.fdfollowgroupconfig.FdFollowGroupConfigIdDto;
import com.uzai.console.dto.fd.fdfollowgroupconfig.FdFollowGroupConfigQuery;
import com.uzai.console.dto.fd.fdfollowgroupconfig.FdFollowGroupConfigStatusDto;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.fd.FdFollowGroupConfigService;
import com.uzai.console.vo.fd.fdfollowgroupconfig.FdFollowGroupConfigVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 跟发采集群配置
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "自动跟发采集群配置",tags = "个人微信|发单|自动跟发采集群配置")
@ApiSort(104)
@RestController
public class FdFollowGroupConfigController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(FdFollowGroupConfigController.class);

    @Autowired
    private FdFollowGroupConfigService fdFollowGroupConfigService;

    @ApiOperation(value = "分页查询自动跟发采集群配置列表", notes = "分页查询自动跟发采集群配置列表", response = FdFollowGroupConfigVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/fdFollowGroupConfig/findFdFollowGroupConfigList")
    public Object findFdFollowGroupConfigList(@RequestBody FdFollowGroupConfigQuery fdFollowGroupConfigQuery){
        return fdFollowGroupConfigService.findFdFollowGroupConfigList(fdFollowGroupConfigQuery);
    }

    @SystemLogType(model = SystemModelEnum.FdFollowGroupConfig, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "添加自动跟发采集群配置任务", notes = "添加自动跟发采集群配置任务")
    @ApiOperationSupport(order = 2)
    @PostMapping("/fdFollowGroupConfig/addFdFollowGroupConfig")
    public Object addFdFollowGroupConfig(@RequestBody FdFollowGroupConfigDto fdFollowGroupConfigDto){
        fdFollowGroupConfigService.addFdFollowGroupConfig(fdFollowGroupConfigDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.FdFollowGroupConfig, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "编辑自动跟发采集群配置任务", notes = "编辑自动跟发采集群配置任务" )
    @ApiOperationSupport(order = 3)
    @PostMapping("/fdFollowGroupConfig/updateFdFollowGroupConfig")
    public Object updateFdFollowGroupConfig(@RequestBody FdFollowGroupConfigDto fdFollowGroupConfigDto){
        fdFollowGroupConfigService.updateFdFollowGroupConfig(fdFollowGroupConfigDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.FdFollowGroupConfig, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除自动跟发采集群配置任务", notes = "删除自动跟发采集群配置任务")
    @ApiOperationSupport(order = 4)
    @PostMapping("/fdFollowGroupConfig/deleteFdFollowGroupConfig")
    public Object deleteFdFollowGroupConfig(@RequestBody FdFollowGroupConfigIdDto fdFollowGroupConfigIdDto){
        fdFollowGroupConfigService.deleteFdFollowGroupConfig(fdFollowGroupConfigIdDto);
        return true;
    }

    @ApiOperation(value = "查询自动跟发采集群配置任务详情", notes = "查询自动跟发采集群配置任务详情", response = FdFollowGroupConfigVo.class)
    @ApiOperationSupport(order = 5)
    @PostMapping("/fdFollowGroupConfig/findFdFollowGroupConfig")
    public Object findFdFollowGroupConfig(@RequestBody FdFollowGroupConfigIdDto fdFollowGroupConfigIdDto){
        return fdFollowGroupConfigService.findFdFollowGroupConfig(fdFollowGroupConfigIdDto);
    }

    @ApiOperation(value = "开启关闭自动跟发采集群配置任务", notes = "开启关闭自动跟发跟发采集群配置任务", response = Boolean.class)
    @ApiOperationSupport(order = 6)
    @PostMapping("/fdFollowGroupConfig/updateStatus")
    public Object updateStatus(@RequestBody FdFollowGroupConfigStatusDto fdFollowGroupConfigStatusDto){
        fdFollowGroupConfigService.updateStatus(fdFollowGroupConfigStatusDto);
        return true;
    }

}
